//
// Created by 11510 on 2024/6/8.
//

#include <unistd.h>
#include <iostream>
using std::cin;
using std::cerr;
using std::cout;
using std::endl;

class Point{
private:
    int _ix;
    int _iy;
public:

    /* explicit 禁止隐式类型转换*/
    explicit Point(int x = 0 ,int y = 0)
            : _ix(x), _iy(y){
        cout << "construct" << endl;
    }

    Point(const Point & rhs)
            : _ix(rhs._ix), _iy(rhs._iy){}

    Point& operator=(const Point& rhs){
        this->_ix = rhs._ix;
        this->_iy = rhs._iy;
        return *this;
    };

    void print() const{
        cout << "(" << _ix
             << "," << _iy
             << ")" << endl;
    }

    ~Point(){
        cout << "~Point()" << endl;
    }
};



void test0(){
    /***
     * 隐式转换
     * 编译器会用int类型数据创建匿名的point对象
     * y为默认值
     * Point p = Point(1)
     */
    Point pt;
    pt.print();
}


int main() {
    test0();
    return 0;
}